<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:79:"D:\phpstudy_pro\WWW\nmg002\public/../application/admin\view\teachers\lists.html";i:1657892130;}*/ ?>
 <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title><?php echo $setting['webname']; ?>-负责老师管理</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link href="/public/static/admin/layui/css/layui.css" rel="stylesheet">
    <link rel="shortcut icon" href="/public/static/favicon.ico"> <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/public/static/admin/css/animate.css" rel="stylesheet">
    <link href="/public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="/public/static/admin/css/plugins/switchery/switchery.css" rel="stylesheet">
	<style>
	  .tools a i{
	    color:#19a9d5
	  }
	  .tools a i:hover{
	    text-shadow:0px 0px 5px #19a9d5;
	  }
	</style>

</head>

<body class="gray-bg">
    <div class="row wrapper border-bottom white-bg page-heading">
        <div class="col-sm-4">
            <h2>负责老师管理</h2>
            <ol class="breadcrumb">
                <li>
                    <a href="<?php echo url('Admins/admin'); ?>">主页</a>
                </li>
                <li>
                    <strong>负责老师</strong>
                </li>
            </ol>
        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>负责老师列表</h5>
                        <div class="ibox-tools tools">
                            <a href="<?php echo url('Teachers/addform'); ?>"><i class="glyphicon glyphicon-plus" title="添加图片"></i></a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                    <tr>
                                        <th>编号</th>
                                        <th>头像</th>
                                        <th>姓名</th>
                                        <th>性别</th>
                                        <th>电话</th>
                                        <th>登录二维码</th>
                                        <th>微信二维码</th>
                                        <th>分享地址</th>
                                        <th>分享文案</th>
                                        <th>所属组</th>
                                        <th>点名</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                </thead>
                                <tbody>
                                <?php if(!empty($teacher)): foreach($teacher as $vo): ?>
                                    <tr>
                                        <td><?php echo $vo['id']; ?></td>
                                        <td>
                                            <?php if(!empty($vo['photo'])): if(preg_match('/base64/',$vo['photo']) > 0): ?>
                                                    <img src="<?php echo $vo['photo']; ?>"  height="40" />
                                                <?php else: ?>
                                                    <img src="/public/static/admin/uploads/teacher_photo/<?php echo $vo['photo']; ?>"   height="40" />
                                                <?php endif; else: ?>
                                            <span style="color:red">无</span>
                                            <?php endif; ?>
                                        </td>
                                        <td><?php echo $vo['name']; ?></td>
                                        <td><?php if($vo['sex'] == 1): ?>男<?php elseif($vo['sex'] == 2): ?>女<?php endif; ?></td>
                                        <td><?php echo $vo['tel']; ?></td>
                                        <td>
                                            <?php if(!empty($vo['qr_src'])): ?>
                                            <img src="/public/static/admin/uploads/teacher_qrcode/<?php echo $vo['qr_src']; ?>"  class="qr<?php echo $vo['id']; ?>" height="80"/>
                                            <?php else: ?>
                                             <span style="color:red">无</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php if(!empty($vo['wx_qrcode'])): ?>
                                            <img src="/public/static/admin/uploads/teacher_qr/<?php echo $vo['wx_qrcode']; ?>" height="80"/>
                                            <?php else: ?>
                                            <span style="color:red">无</span>
                                            <?php endif; ?>
                                        </td>
                                        <td width="200">
                                            <?php if(empty($vo['adv_href'])): ?>
                                            无
                                            <?php else: ?>
                                            <span title="<?php echo $vo['adv_href']; ?>"><?php echo substr($vo['adv_href'],0,20); ?>……</span>
                                            <?php endif; ?>
                                        </td>
                                        <td  width="200">
                                            <?php if(empty($vo['adv_str'])): ?>
                                            无
                                            <?php else: ?>
                                            <span title="<?php echo $vo['adv_str']; ?>"><?php echo mb_substr($vo['adv_str'],0,20); ?>……</span>
                                            <?php endif; ?>
                                        </td>
                                        <td>
                                            <?php echo $th[$vo['pid']]; ?>
                                        </td>
                                        <td><input type="checkbox" class="js-attendances js-switch" data-id="<?php echo $vo['id']; ?>" <?php if($vo['is_attendances'] == 1): ?>checked<?php endif; ?> /></td>
                                        <td><input type="checkbox" class="js-switch is-status" data-id="<?php echo $vo['id']; ?>" <?php if($vo['status'] == 1): ?>checked<?php endif; ?> /></td>
                                        <td class="tools"><a href="<?php echo url('Teachers/update'); ?>?id=<?php echo $vo['id']; ?>"><i class="glyphicon glyphicon-pencil" style="color:#19a9d5"></i></a> <a class="del" data-id="<?php echo $vo['id']; ?>" data-name="<?php echo $vo['name']; ?>"><i class="glyphicon glyphicon-trash"style="color:#19a9d5"></i></a>
                                            <a class="re_qrcode" data-id="<?php echo $vo['id']; ?>"><i class="fa fa-refresh" title="重新生成登录二维码"></i></a></td>
                                    </tr>
                                <?php endforeach; else: ?>
                                <tr>
                                    <td colspan="6">没有数据</td>
                                </tr>
                                <?php endif; ?>
                                </tbody>
                            </table>
                        </div>

                    </div>
                </div>
            </div>

        </div>
    </div>

    <!-- 全局js -->
    <script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>
    <!-- Peity -->
    <script src="/public/static/admin/js/plugins/peity/jquery.peity.min.js"></script>
    <!-- 自定义js -->
    <script src="/public/static/admin/js/content.js?v=1.0.0"></script>
    <!-- iCheck -->
    <script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
    <!-- Switchery -->
    <script src="/public/static/admin/js/plugins/switchery/switchery.js"></script>
    <!-- Peity -->
    <script src="/public/static/admin/js/demo/peity-demo.js"></script>
    <script src="/public/static/admin/layui/layui.js"></script>
    <script>
        layui.use('layer', function(){ //独立版的layer无需执行这一句
            var $ = layui.jquery, layer = layui.layer; //独立版的layer无需执行这一句
            //点击提交
            $(".del").click(function(){
                var s = $(this);
                top.layer.msg('你确定要删除 \''+s.data("name")+'\' 吗？', {
                    time: 20000, //20s后自动关闭
                    shade: 0.8,
                    btn: ['确定', '取消'],
                    btn1:function(){
                        $.post("<?php echo url('Teachers/deletes'); ?>",{id:s.data('id')},function(data){
                            top.layer.closeAll();
                            top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
                                if(data.url){
                                    window.location.href = data.url;
                                }
                            });
                        });
                    }
                });

            });
        });
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });
        //状态的切换按钮的初始化样式
        var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
        elems.forEach(function(html) {
            var switchery = new Switchery(html,{ size: 'small' });
        });
        //修改状态
        $(".js-attendances").change(function(){
            var checkedS = $(this).is(":checked");
            var ids = $(this).attr("data-id");
            var st = "";
            var str = "";
            if(checkedS){
                st = 1;
                str = "修改可以点名";
            }else{
                st = 2;
                str = "修改不可以点名";
            }
            $.post("<?php echo url('Teachers/setAttendances'); ?>",{id:ids,is_attendances:st},function(data){
                top.layer.msg(str+data.msg,{time:2000,shade:0.5});
            });
        });
        //修改状态
        $(".is-status").change(function(){
            var checkedS = $(this).is(":checked");
            var ids = $(this).attr("data-id");
            var st = "";
            var str = "";
            if(checkedS){
                st = 1;
                str = "启用";
            }else{
                st = 2;
                str = "禁用";
            }
            $.post("<?php echo url('Teachers/setStatus'); ?>",{id:ids,status:st},function(data){
                top.layer.msg(str+data.msg,{time:2000,shade:0.5});
            });
        });
        //重新生成登录二维码
        $(".re_qrcode").on("click",function(){
            $this = $(this);
            $.post("<?php echo url('Teachers/re_qrcode'); ?>",{id:$this.data("id")},function(data){
                if(data.code == 1){
                    $(".qr"+$this.data("id")).attr("src","/public/static/admin/uploads/teacher_qrcode/"+data.msg);
                }else{
                    top.layer.msg(data.msg,{time:2000,shade:0.5});
                }
            })
        })
    </script>

    
    

</body>

</html>
